package com.wg.core.utils;

public class ThreadUtils {
    public static String printStackTrace() {
        final StackTraceElement[] st = Thread.currentThread().getStackTrace();
        StringBuilder sb = new StringBuilder(2048);
        sb.append("\n");
        for (StackTraceElement e : st) {
            sb.append("\tat ").append(e).append("\n");
        }
        return sb.toString();
    }

    public static String printStackTrace(Exception e) {
        final StackTraceElement[] st = e.getStackTrace();
        StringBuilder sb = new StringBuilder(2048);
        sb.append("\n");
        sb.append(e.getMessage()).append("\n");
        for (StackTraceElement s : st) {
            sb.append("\tat ").append(s).append("\n");
        }
        return sb.toString();
    }
}
